package com.financial.sys.controller.bank;


import com.financial.common.vo.Result;
import com.financial.model.pojo.TWithdraw;
import com.financial.sys.service.bank.TWithdrawService;
import com.financial.sys.service.user.TUserWalletsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户提现管理")
@RestController
@RequestMapping("/user/withdraw")
public class TWithdrawController {

    @Autowired
    private TWithdrawService tWithdrawService;

    @Autowired
    private TUserWalletsService tUserWalletService;

    @ApiOperation("用户提现")
    @PostMapping("/add")
    public Result bankCardAdd(@ApiParam(name = "tWithdraw",value = "用户提现对象") TWithdraw tWithdraw){
        int i=tWithdrawService.TWithdrawAdd(tWithdraw);
        if(i==0){
            return Result.error().message("余额不足!");
        }
        if(i>0){
            return Result.ok().data(i);
        }
        return Result.error().message("提现失败!");
    }
}
